home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Mail
/
pine3.92
/
pine
/
osdep
/
bld_path.dos
< prev
next >
Wrap
Text File
|
1995-12-06
|
1KB
|
57 lines
/*----------------------------------------------------------------------
Paste together two pieces of a file name path
Args: pathbuf -- Put the result here
first_part -- of path name
second_part -- of path name
Result: New path is in pathbuf. No check is made for overflow.
BUGS: This is a first stab at dealing with fs naming dependencies, and others
still exist.
----*/
void
build_path(pathbuf, first_part, second_part)
char *pathbuf, *first_part, *second_part;
{
register int i;
if(!first_part){
strcpy(pathbuf, second_part);
return;
}
for(i = 0; first_part[i]; i++)
*pathbuf++ = first_part[i];
if(i && first_part[i-1] == '\\'){ /* first part ended with \ */
if(*second_part == '\\') /* and second starts with \ */
second_part++; /* else just append second */
}
else if(*second_part != '\\') /* no slash at all, so */
*pathbuf++ = '\\'; /* insert one... */
while(*second_part)
*pathbuf++ = *second_part++;
*pathbuf = '\0';
}
/*----------------------------------------------------------------------
Test to see if the given file path is absolute
Args: file -- file path to test
Result: TRUE if absolute, FALSE otw
----*/
int
is_absolute_path(path)
char *path;
{
return(path && (*path == '\\' || (isalpha(path[0]) && path[1] == ':')));
}